package com.sikaryofficial.workbench.controller;

import com.sikaryofficial.common.core.domain.R;
import com.sikaryofficial.system.api.RemoteDictService;
import com.sikaryofficial.system.api.domain.SysDictData;
import com.sikaryofficial.workbench.domain.dto.resp.SysDictDataDTO;
import com.sikaryofficial.workbench.domain.mapping.DictMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : qinjinyuan
 * @desc : 工作台字典服务接口
 * @date : 2025/02/26 8:36
 */
@RestController
@RequestMapping("/dict")
@Api(tags = "工作台字典服务")
@Slf4j
public class WorkbenchDictController {
    @Autowired
    private RemoteDictService remoteDictService;

    @GetMapping("/whatAppUrl")
    @ApiOperation(value = "获取直接对话功能地址列表")
    public R<List<SysDictDataDTO>> whatAppUrl() {
        R<List<SysDictData>> result = remoteDictService.dictType("what_app_url");
        if (R.isSuccess(result)) {
            return R.ok(DictMapping.INSTANCE.convertToResp(result.getData()));
        }
        return R.fail(result.getMsg());
    }
}
